home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kjs / operations.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  2.7 KB  |  80 lines

  1. // -*- c-basic-offset: 2 -*-
  2. /*
  3.  *  This file is part of the KDE libraries
  4.  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
  5.  *
  6.  *  This library is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU Library General Public
  8.  *  License as published by the Free Software Foundation; either
  9.  *  version 2 of the License, or (at your option) any later version.
  10.  *
  11.  *  This library is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  *  Library General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU Library General Public License
  17.  *  along with this library; see the file COPYING.LIB.  If not, write to
  18.  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.  *  Boston, MA 02110-1301, USA.
  20.  *
  21.  */
  22.  
  23. #ifndef _KJS_OPERATIONS_H_
  24. #define _KJS_OPERATIONS_H_
  25.  
  26. #include "value.h"
  27.  
  28. namespace KJS {
  29.  
  30.   class ExecState;
  31.  
  32.   /**
  33.    * @return True if d is not a number (platform support required).
  34.    */
  35.   bool isNaN(double d);
  36.   /**
  37.    * @return True if d is infinite (platform support required).
  38.    */
  39.   bool isInf(double d);
  40.   bool isPosInf(double d);
  41.   bool isNegInf(double d);
  42.   bool equal(ExecState *exec, const Value& v1, const Value& v2);
  43.   bool strictEqual(ExecState *exec, const Value &v1, const Value &v2);
  44.   /**
  45.    * This operator performs an abstract relational comparison of the two
  46.    * arguments that can be of arbitrary type. If possible, conversions to the
  47.    * string or number type will take place before the comparison.
  48.    *
  49.    * @return 1 if v1 is "less-than" v2, 0 if the relation is "greater-than-or-
  50.    * equal". -1 if the result is undefined.
  51.    */
  52.   int relation(ExecState *exec, const Value& v1, const Value& v2);
  53.   int maxInt(int d1, int d2);
  54.   int minInt(int d1, int d2);
  55.   /**
  56.    * Additive operator. Either performs an addition or substraction of v1
  57.    * and v2.
  58.    * @param exec execution state.
  59.    * @param v1 First operand.
  60.    * @param v2 Second operand.
  61.    * @param oper '+' or '-' for an addition or substraction, respectively.
  62.    * @return The result of the operation.
  63.    */
  64.   Value add(ExecState *exec, const Value &v1, const Value &v2, char oper);
  65.   /**
  66.    * Multiplicative operator. Either multiplies/divides v1 and v2 or
  67.    * calculates the remainder from an division.
  68.    * @param exec execution state.
  69.    * @param v1 First operand.
  70.    * @param v2 Second operand.
  71.    * @param oper '*', '/' or '%' for a multiplication, division or
  72.    * modulo operation.
  73.    * @return The result of the operation.
  74.    */
  75.   Value mult(ExecState *exec, const Value &v1, const Value &v2, char oper);
  76.  
  77. }
  78.  
  79. #endif
  80.